package com.lhkj.ct.base.utils;

import java.io.Serializable;

/**
 * @Description: 三元组
 * @Author:
 * @Date: 2020/6/10 9:17
 */

public class Tuple3<T1, T2, T3> implements Serializable {
    private T1 t1;
    private T2 t2;
    private T3 t3;

    public Tuple3(T1 t1, T2 t2, T3 t3) {
        this.t1 = t1;
        this.t2 = t2;
        this.t3 = t3;
    }

    public T1 getT1() {
        return t1;
    }

    public void setT1(T1 t1) {
        this.t1 = t1;
    }

    public T2 getT2() {
        return t2;
    }

    public void setT2(T2 t2) {
        this.t2 = t2;
    }

    public T3 getT3() {
        return t3;
    }

    public void setT3(T3 t3) {
        this.t3 = t3;
    }

    @Override
    public int hashCode() {
        return (t1 == null ? 0 : t1.hashCode()) + (t2 == null ? 0 : t2.hashCode()) + (t3 == null ? 0 : t3.hashCode());
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj instanceof Tuple3) {
            Tuple3 target = (Tuple3) obj;
            if (t1 == null ? target.getT1() != null : !t1.equals(target.getT1())) {
                return false;
            }
            if (t2 == null ? target.getT2() != null : !t2.equals(target.getT2())) {
                return false;
            }
            if (t3 == null ? target.getT3() != null : !t3.equals(target.getT3())) {
                return false;
            }
            return true;
        }
        return false;
    }

    @Override
    public String toString() {
        return "Tuple3{" +
                "t1=" + t1 +
                ", t2=" + t2 +
                ", t3=" + t3 +
                '}';
    }
}
